#! /bin/sh

name=sdl3
version=3.2.12
revision=1
tarball_url="https://github.com/libsdl-org/SDL/releases/download/release-${version}/SDL3-${version}.tar.gz"
tarball_blake2b="319e6e8f7348047d2aaa80ccd8b6a321e601a9bce58c338915b7c5a0e62b96d50ebd4de4ef47f9e5613f10c2c5f26220e769e19d8629cb590da92b42dd0731ab"
imagedeps="cmake ninja-build git"
hostdeps="gcc pkg-config"
deps="core-libs libx11 libxext libxcursor libxi libxfixes libxrandr libxrender libxxf86vm mesa"

configure() {
    cmake_configure \
        -DSDL_ALTIVEC=OFF \
        -DSDL_DISKAUDIO=OFF \
        -DSDL_OPENGL=ON \
        -DSDL_OPENGLES=ON \
        -DSDL_PTHREADS=ON \
        -DSDL_PTHREADS_SEM=OFF \
        -DSDL_OSS=OFF \
        -DSDL_ALSA=OFF \
        -DSDL_JACK=OFF \
        -DSDL_PULSEAUDIO=OFF \
        -DSDL_SNDIO=OFF \
        -DSDL_RPATH=OFF \
        -DSDL_X11=ON \
        -DSDL_WAYLAND=OFF \
        -DSDL_RPI=OFF \
        -DSDL_COCOA=OFF \
        -DSDL_DIRECTX=OFF \
        -DSDL_WASAPI=OFF \
        -DSDL_RENDER_D3D=OFF \
        -DSDL_VIVANTE=OFF \
        -DSDL_VULKAN=OFF \
        -DSDL_KMSDRM=OFF \
        -DSDL_HIDAPI=ON \
        -DSDL_SHARED=ON \
        -DSDL_STATIC=OFF \
        -DSDL_TEST_LIBRARY=OFF
}

build() {
    ninja -j${parallelism}
}

package() {
    DESTDIR="${dest_dir}" ninja install

    post_package_strip
}
